<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property int $user_id 用户id
 * @property string $symbol 币种
 * @property string $code 标识
 * @property string $trade_no 交易单号
 * @property int $status 1已支付
 * @property int $recharge 成功0充余额1充游戏
 * @property string $amount 金额
 * @property string $pay_at 到账时间
 * @property string $pump 抽水
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property-read null|Account $account
 */
class AccountRecharge extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'account_recharge';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'user_id', 'symbol', 'code', 'trade_no', 'status', 'recharge', 'amount', 'pay_at', 'pump', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'status' => 'integer', 'recharge' => 'integer', 'amount' => 'decimal:8', 'pump' => 'decimal:8', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function account(): HasOne
    {
        return $this->hasOne(Account::class, 'gene_id', 'user_id');
    }
}
